Aspects of the present invention relate to multi-threading. Other aspects of the present invention relate to inter-thread communications.
Multithreading technologies have been widely used in various applications. Multithreaded applications often utilize software components from different vendors that, when forming a coherent application, need to communicate with each other. Such multithreaded applications require more sophisticated management due to the communication links between different threads.
The major issues in multithreading communications include properly allocating and utilizing shared memory as well as sending and receiving messages. Conventionally, inter-thread communications may be carried out through sending messages or receiving messages directly between the threads that are communicating. Such inter-thread communications may become particularly problematic when different threads are from different vendors that deal with different types of tasks. For example, graphical user interface software components from software vendors such as Microsoft may be substantially different, both in functionality as well as in software behavior, from a software component from a different vendor that deals with, for instance, modem connections.
In general, threads may be categorized into two groups: user interface threads and worker threads. The former usually handles user input and respond to both event and messages generated by the user. The latter are commonly used to complete low level library function calls (e.g., low level device interaction) that do not involve user intervention. Threads of these two categories carry out tasks of different nature and usually behave differently. For example, compared with a worker thread, a user interface thread exhausts a much greater amount of resource. In addition, a user interface thread usually has a more complicated structure. Due to these reasons, the processing time and the efficiency in resource usage of a user interface thread may differ significantly from that of a of a worker thread.
The difference in the above mentioned two categories of threads may introduce difficulties in designing multithreaded applications. Many existing multithreading applications use user interface threads to perform both user interfacing tasks and the tasks of a worker thread. Such multithreading applications, particularly large scale multithreading applications, are difficult to implement and to maintain.
Even when the two categories of threads are distinguished and implemented separately, the difference in these two categories of threads introduces difficulties in conducting effective inter-thread communications. Some existing multithreading applications utilize a single user interface thread to communicate with several worker threads. Such an arrangement may limit the multitasking capability of user interface and flexibility in a single user interface during inter-thread communications.